package th.go.drr.gps.web.security;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;

import th.go.drr.gps.repository.h.AuthenticationHandler;


public class UserDetailsGis implements UserDetailsService {

	private static Logger logger = Logger.getLogger(UserDetailsGis.class);
	@Autowired
	@Qualifier("authenticationHandler")	
	private AuthenticationHandler authenticationHandler;	
	
	@Override
	public UserDetails loadUserByUsername(String arg0)
			throws UsernameNotFoundException {
//		logger.info("yyyyyyyyyyyyyy");
		UserData u = new UserData();
		u.load(authenticationHandler,arg0);
		return u;
	}


	public AuthenticationHandler getAuthenticationHandler() {
		return authenticationHandler;
	}


	public void setAuthenticationHandler(AuthenticationHandler authenticationHandler) {
		this.authenticationHandler = authenticationHandler;
	}


}